#include "gd32f4xx.h"
#include "systick.h"
#include <stdio.h>
//#include "main.h"

#include "usart0.h"
#include "led.h"
#include "key.h"
#include "w25q.h"

#include "exmc_sdram.h"
#include "lcd.h"
#include "touch.h"
#include "bsp_basic_timer.h"
#include "bsp_encoder.h"

#include "bsp_pwm.h"//舵机pwm

#include "lvgl.h"
#include "lv_port_disp_template.h"
#include "lv_port_indev_template.h"

#include "gui_guider.h"
#include "events_init.h"
#include "guider_lv_conf.h"


lv_ui ui;
int main(void)
{                 
	nvic_priority_group_set(NVIC_PRIGROUP_PRE2_SUB2);  // 优先级分组
  systick_config();
  usart0_init();
  led_init();
//  key_init();
	W25Q_Init(); //时序未成功
	
	Encoder_GPIO_Init();//旋转编码器
	pwm_config(2000,2000);//舵机
  
  exmc_synchronous_dynamic_ram_init(EXMC_SDRAM_DEVICE0); //RGB屏Gram,初始化
	
	basic_timer_config(200,1200);//事件扫描心跳(lvgl 占用了)
	
	lv_init();
	lv_port_disp_init();	//LVGL显示初始化
	lv_port_indev_init();	//LVGL输入设备初始化


	setup_ui(&ui);
	setup_scr_screen(&ui);
	
	while(1)
	{
	 lv_timer_handler();
		 //delay_1ms(1);
		 
		
	}
}


